﻿<%@ Page Language="C#" MasterPageFile="~/Site.master" CodeBehind="~/DynamicData/PageTemplates/List.aspx.cs" Inherits="SRS.List" %>
     
<%@ Register src="~/DynamicData/Content/GridViewPager.ascx" tagname="GridViewPager" tagprefix="asp" %>

<asp:Content ID="headContent" ContentPlaceHolderID="head" Runat="Server">
</asp:Content>

<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
    <div class="SRS_PageLayout">

    <h2 class="SRSSubHeader"><%= table.DisplayName%></h2>

    <asp:UpdatePanel ID="UpdatePanel1" runat="server">
        <ContentTemplate>
            <div class="SRS">
                <asp:ValidationSummary ID="ValidationSummary1" runat="server" EnableClientScript="true"
                    HeaderText="List of validation errors" Cssclass="SRSValidator" />
                <asp:DynamicValidator runat="server" ID="GridViewValidator" ControlToValidate="GridView1" Display="None" Cssclass="SRSValidator" />

                <asp:QueryableFilterRepeater runat="server" ID="FilterRepeater">
                    <ItemTemplate>
                        <asp:Label runat="server" Text='<%# Eval("DisplayName") %>' OnPreRender="Label_PreRender" />
                        <asp:DynamicFilter runat="server" ID="DynamicFilter" /><br />
                    </ItemTemplate>
                </asp:QueryableFilterRepeater>
            </div>

            <asp:GridView ID="GridView1" runat="server" DataSourceID="GridDataSource" EnablePersistedSelection="true"
                AllowPaging="True" AllowSorting="True" Cssclass="SRSGridView"
                RowStyle-CssClass="td" HeaderStyle-CssClass="th" CellPadding="6">
                <Columns>
                    <asp:TemplateField>
                        <ItemTemplate>
                            <div class="SRS_DBModifierActions_ViewEdit">
                            <img id="Img1" runat="server" src="~/Images/18x18/modifier_details.png" alt="Insert new item" />
                            <asp:DynamicHyperLink ID="DynamicHyperLink1" runat="server" Text="View Details" />&nbsp;&nbsp;
                            <img id="Img2" runat="server" src="~/Images/18x18/modifier_edit.png" alt="Insert new item" />
                            <asp:DynamicHyperLink ID="DynamicHyperLink2" runat="server" Action="Edit" Text="Edit Record" />
                            </div>
                            <div class="SRS_DBModifierActions_Delete">
                            <img id="Img3" runat="server" src="~/Images/18x18/modifier_delete.png" alt="Insert new item" />
                            <asp:LinkButton runat="server" CommandName="Delete" Text="Delete Record"
                                OnClientClick='return confirm("Are you sure you want to delete this item?");' />
                            </div>
                        </ItemTemplate>
                    </asp:TemplateField>
                </Columns>

                <PagerStyle Cssclass="SRSFooter"/>        
                <PagerTemplate>
                    <asp:GridViewPager runat="server" />
                </PagerTemplate>
                <EmptyDataTemplate>
                    There are currently no items in this table.
                </EmptyDataTemplate>
            </asp:GridView>

            <asp:EntityDataSource ID="GridDataSource" runat="server" EnableDelete="True" 
                ConnectionString="name=SRSEntities" DefaultContainerName="SRSEntities" 
                EnableFlattening="False" EnableInsert="True" EnableUpdate="True" 
                EntitySetName="Requests" EntityTypeFilter="Request" />
            
            <asp:QueryExtender TargetControlID="GridDataSource" ID="GridQueryExtender" runat="server">
                <asp:DynamicFilterExpression ControlID="FilterRepeater" />
            </asp:QueryExtender>

            <br />

            <div class="SRSBottomHyperLink">
                <asp:DynamicHyperLink ID="InsertHyperLink" runat="server" Action="Insert"><img runat="server" src="~/Images/18x18/database_insert.png" alt="Insert new item" />Insert new item</asp:DynamicHyperLink>
            </div>
        </ContentTemplate>
    </asp:UpdatePanel>
    </div>
</asp:Content>

